<?php

class Settings extends CI_Controller
{

    public function index()
    {
        $data['title'] = 'List Setting';

        $this->load->view('templates/default/header', $data);
        $this->load->view('templates/default/setting/index', $data);
        $this->load->view('templates/default/footer');
    }

    public function create()
    {
        $this->load->helper('form');
        $this->load->library('form_validation');

        $this->form_validation->set_rules('name', 'name', 'required');
        $this->form_validation->set_rules('value', 'value', 'required');

        $data['title'] = 'Create Setting';

        if ($this->form_validation->run() == false)
        {
            $this->load->view('templates/default/header', $data);
            $this->load->view('templates/default/setting/create', $data);
            $this->load->view('templates/default/footer');

        } else
        {
            $this->settings_model->set();
            $this->load->view('settings/success');
        }
    }
}
